package fr.adfm.database.initialization;


import org.springframework.context.support.ClassPathXmlApplicationContext;

public class CreateTest {
	
	public static void main(String[] args) {
		
		// remove data
		
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:META-INF/test-update-context.xml");
		DbCreateDataForTesting dbMembers = (DbCreateDataForTesting) context.getBean("dbCreateDataForTesting");
		try{
			dbMembers.removeData();
		}
		catch(Exception e)
		{
			
		}

		context.close();
		
		// build schema
		
		context = new ClassPathXmlApplicationContext("classpath:META-INF/test-context.xml");
		context.close();	
		
		// create data
		context = new ClassPathXmlApplicationContext("classpath:META-INF/test-update-context.xml");
		dbMembers = (DbCreateDataForTesting) context.getBean("dbCreateDataForTesting");
		dbMembers.createData();
		context.close();
	}

}
